//
//  AddImageCell.m
//  DingDing
//
//  Created by LHL on 14/12/3.
//  Copyright (c) 2014年 com.gordon. All rights reserved.
//

#import "AddImageCell.h"
#import "Common.h"
@implementation AddImageCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.addImage = [UIButton buttonWithType:UIButtonTypeCustom];
        self.addImage.frame = CGRectMake(10, 10, 70, 70);
        [self.addImage setImage:[UIImage imageNamed:@"addDyc.png"] forState:0];
        [self.contentView addSubview:self.addImage];
        for (int i = 0;i< 9; i++) {
            UIImageView *img = [[UIImageView alloc]init];
            img.tag = 11000+i;
            img.frame = CGRectZero;
            [self.contentView addSubview:img];
            UIButton *deletebutton = [UIButton buttonWithType:UIButtonTypeCustom];
            deletebutton.tag = 11120+i;
            [deletebutton addTarget:self action:@selector(deleteFunc:) forControlEvents:UIControlEventTouchUpInside];
            deletebutton.frame = CGRectZero;
            [deletebutton setImage:[UIImage imageNamed:@"deletephoto.png"] forState:0];
            [self.contentView addSubview:deletebutton];
        }
    }
    return self;
}
-(void)deleteFunc:(UIButton *)sender{
    if (self.block) {
        self.block(sender.tag-11120);
    }
}
-(void)getDeleteInteger:(deleteInteger)block{
    self.block = [block copy];
}

@end
